Regulated rewriting